<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script>
		    //没有用new语法糖,也没有用prototype接口
			(function(){
				var Yf = function(ID){
					var obj = {};
					obj.ID = ID;
					obj.__proto__ = ooo;
					//obj.init = function(){}
					obj.init();
					return obj;
				}
				ooo = {
					constructor:Yf,
					init:function(){
						console.log(this.ID);
						console.log(ooo.constructor);
					}
				}
				var yf = Yf(100);
				var yf2 = Yf(200);
				console.log(yf.init === yf2.init);
				
			})();
			
			
			
			
			//用了new语法糖
			(function(){
				var Yf = function(ID){
					this.ID = ID;
					this.init();
				}
				Yf.prototype = {
					constructor:Yf,
					init:function(){
						console.log(this.ID);
						console.log(Yf.prototype.constructor);
					}
				}
				var yf = new Yf(200);
				var ygy = {};
				console.log(ygy);
				var ygyfn = function(){
					
				}
				console.log(ygyfn.prototype);
			})();
		</script>
	</head>
	<body>
	</body>
</html>
